{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import re"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python2.7/dist-packages/IPython/core/interactiveshell.py:2718: DtypeWarning: Columns (5,60) have mixed types. Specify dtype option on import or set low_memory=False.\n",
      "  interactivity=interactivity, compiler=compiler, result=result)\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Name</th>\n",
       "      <th>Identification</th>\n",
       "      <th>MachineType</th>\n",
       "      <th>ProgramHeaderOffset</th>\n",
       "      <th>SectionHeaderOffset</th>\n",
       "      <th>Flags</th>\n",
       "      <th>HeaderSize</th>\n",
       "      <th>SizeProgramHeader</th>\n",
       "      <th>EntriesProgram</th>\n",
       "      <th>SizeSectionHeader</th>\n",
       "      <th>...</th>\n",
       "      <th>DYNHASH</th>\n",
       "      <th>DYNDEBUG</th>\n",
       "      <th>DYNFINI_ARRAY</th>\n",
       "      <th>DYNNULL</th>\n",
       "      <th>R_386_GLOB_DAT</th>\n",
       "      <th>R_386_JUMP_SLOT</th>\n",
       "      <th>R_386_COPY</th>\n",
       "      <th>GOT_SIZE</th>\n",
       "      <th>HASH_SIZE</th>\n",
       "      <th>label</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>42d7e2ac43d89f40d5e0debf3a4294fce4ee75ffae2db9...</td>\n",
       "      <td>7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00</td>\n",
       "      <td>Intel 80386</td>\n",
       "      <td>52</td>\n",
       "      <td>2345688</td>\n",
       "      <td>0</td>\n",
       "      <td>52</td>\n",
       "      <td>32</td>\n",
       "      <td>8</td>\n",
       "      <td>40</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1316</td>\n",
       "      <td>156</td>\n",
       "      <td>M</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>pstopnm</td>\n",
       "      <td>7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00</td>\n",
       "      <td>Advanced Micro Devices X86-64</td>\n",
       "      <td>64</td>\n",
       "      <td>16976</td>\n",
       "      <td>0</td>\n",
       "      <td>64</td>\n",
       "      <td>56</td>\n",
       "      <td>9</td>\n",
       "      <td>64</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>336</td>\n",
       "      <td>56</td>\n",
       "      <td>B</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2a5c4b8a739b4c1c85f4866abb02a4699112d09d60ea41...</td>\n",
       "      <td>7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00</td>\n",
       "      <td>Intel 80386</td>\n",
       "      <td>52</td>\n",
       "      <td>95428</td>\n",
       "      <td>0</td>\n",
       "      <td>52</td>\n",
       "      <td>32</td>\n",
       "      <td>3</td>\n",
       "      <td>40</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>12</td>\n",
       "      <td>0</td>\n",
       "      <td>M</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>7fbce893dc6a51456fadcf86179ac0eff9026eb17b7f04...</td>\n",
       "      <td>7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00</td>\n",
       "      <td>Advanced Micro Devices X86-64</td>\n",
       "      <td>64</td>\n",
       "      <td>721864</td>\n",
       "      <td>0</td>\n",
       "      <td>64</td>\n",
       "      <td>56</td>\n",
       "      <td>5</td>\n",
       "      <td>64</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>32</td>\n",
       "      <td>0</td>\n",
       "      <td>M</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>971062ea5bcbfd9998ff22acebc1a361a151fb1fb8d4e6...</td>\n",
       "      <td>7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00</td>\n",
       "      <td>Intel 80386</td>\n",
       "      <td>52</td>\n",
       "      <td>90292</td>\n",
       "      <td>0</td>\n",
       "      <td>52</td>\n",
       "      <td>32</td>\n",
       "      <td>3</td>\n",
       "      <td>40</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>12</td>\n",
       "      <td>0</td>\n",
       "      <td>M</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 148 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                Name  \\\n",
       "0  42d7e2ac43d89f40d5e0debf3a4294fce4ee75ffae2db9...   \n",
       "1                                            pstopnm   \n",
       "2  2a5c4b8a739b4c1c85f4866abb02a4699112d09d60ea41...   \n",
       "3  7fbce893dc6a51456fadcf86179ac0eff9026eb17b7f04...   \n",
       "4  971062ea5bcbfd9998ff22acebc1a361a151fb1fb8d4e6...   \n",
       "\n",
       "                                    Identification  \\\n",
       "0  7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00   \n",
       "1  7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00   \n",
       "2  7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00   \n",
       "3  7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00   \n",
       "4  7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00   \n",
       "\n",
       "                     MachineType  ProgramHeaderOffset  SectionHeaderOffset  \\\n",
       "0                    Intel 80386                   52              2345688   \n",
       "1  Advanced Micro Devices X86-64                   64                16976   \n",
       "2                    Intel 80386                   52                95428   \n",
       "3  Advanced Micro Devices X86-64                   64               721864   \n",
       "4                    Intel 80386                   52                90292   \n",
       "\n",
       "  Flags  HeaderSize  SizeProgramHeader  EntriesProgram  SizeSectionHeader  \\\n",
       "0     0          52                 32               8                 40   \n",
       "1     0          64                 56               9                 64   \n",
       "2     0          52                 32               3                 40   \n",
       "3     0          64                 56               5                 64   \n",
       "4     0          52                 32               3                 40   \n",
       "\n",
       "   ...    DYNHASH  DYNDEBUG DYNFINI_ARRAY  DYNNULL  R_386_GLOB_DAT  \\\n",
       "0  ...          0         0             0        0               0   \n",
       "1  ...          0         1             1        1               0   \n",
       "2  ...          0         0             0        0               0   \n",
       "3  ...          0         0             0        0               0   \n",
       "4  ...          0         0             0        0               0   \n",
       "\n",
       "  R_386_JUMP_SLOT  R_386_COPY  GOT_SIZE  HASH_SIZE  label  \n",
       "0               0           0      1316        156      M  \n",
       "1               0           0       336         56      B  \n",
       "2               0           0        12          0      M  \n",
       "3               0           0        32          0      M  \n",
       "4               0           0        12          0      M  \n",
       "\n",
       "[5 rows x 148 columns]"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_csv(\"./dataset/final.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ProgramHeaderOffset</th>\n",
       "      <th>SectionHeaderOffset</th>\n",
       "      <th>HeaderSize</th>\n",
       "      <th>SizeProgramHeader</th>\n",
       "      <th>EntriesProgram</th>\n",
       "      <th>SizeSectionHeader</th>\n",
       "      <th>EntriesSection</th>\n",
       "      <th>StringTableIndex</th>\n",
       "      <th>.text_size</th>\n",
       "      <th>.text_alignment</th>\n",
       "      <th>...</th>\n",
       "      <th>DYNPLTGOT</th>\n",
       "      <th>DYNHASH</th>\n",
       "      <th>DYNDEBUG</th>\n",
       "      <th>DYNFINI_ARRAY</th>\n",
       "      <th>DYNNULL</th>\n",
       "      <th>R_386_GLOB_DAT</th>\n",
       "      <th>R_386_JUMP_SLOT</th>\n",
       "      <th>R_386_COPY</th>\n",
       "      <th>GOT_SIZE</th>\n",
       "      <th>HASH_SIZE</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>9124.000000</td>\n",
       "      <td>9.124000e+03</td>\n",
       "      <td>9124.000000</td>\n",
       "      <td>9124.000000</td>\n",
       "      <td>9124.000000</td>\n",
       "      <td>9124.000000</td>\n",
       "      <td>9124.000000</td>\n",
       "      <td>9124.000000</td>\n",
       "      <td>9.105000e+03</td>\n",
       "      <td>9105.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>9124.000000</td>\n",
       "      <td>9124.000000</td>\n",
       "      <td>9124.000000</td>\n",
       "      <td>9124.000000</td>\n",
       "      <td>9124.000000</td>\n",
       "      <td>9124.000000</td>\n",
       "      <td>9124.000000</td>\n",
       "      <td>9124.000000</td>\n",
       "      <td>9124.000000</td>\n",
       "      <td>9124.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>55.000877</td>\n",
       "      <td>3.620966e+05</td>\n",
       "      <td>55.023674</td>\n",
       "      <td>38.033319</td>\n",
       "      <td>5.439391</td>\n",
       "      <td>46.047348</td>\n",
       "      <td>24.057541</td>\n",
       "      <td>21.676896</td>\n",
       "      <td>1.098298e+301</td>\n",
       "      <td>18.483251</td>\n",
       "      <td>...</td>\n",
       "      <td>0.272797</td>\n",
       "      <td>0.024989</td>\n",
       "      <td>0.272578</td>\n",
       "      <td>0.244191</td>\n",
       "      <td>0.273345</td>\n",
       "      <td>0.039347</td>\n",
       "      <td>1.759097</td>\n",
       "      <td>0.030359</td>\n",
       "      <td>191.286716</td>\n",
       "      <td>367.629110</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>5.335484</td>\n",
       "      <td>7.717231e+05</td>\n",
       "      <td>5.210034</td>\n",
       "      <td>10.449703</td>\n",
       "      <td>2.486828</td>\n",
       "      <td>10.420069</td>\n",
       "      <td>8.234378</td>\n",
       "      <td>8.887494</td>\n",
       "      <td>inf</td>\n",
       "      <td>43.408611</td>\n",
       "      <td>...</td>\n",
       "      <td>0.445422</td>\n",
       "      <td>0.156100</td>\n",
       "      <td>0.445310</td>\n",
       "      <td>0.429630</td>\n",
       "      <td>0.445701</td>\n",
       "      <td>0.695019</td>\n",
       "      <td>14.090788</td>\n",
       "      <td>0.387035</td>\n",
       "      <td>571.757800</td>\n",
       "      <td>6222.814762</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>0.000000</td>\n",
       "      <td>2.440000e+02</td>\n",
       "      <td>52.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>40.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>52.000000</td>\n",
       "      <td>4.202100e+04</td>\n",
       "      <td>52.000000</td>\n",
       "      <td>32.000000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>40.000000</td>\n",
       "      <td>16.000000</td>\n",
       "      <td>13.000000</td>\n",
       "      <td>1.582500e+04</td>\n",
       "      <td>16.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>12.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>52.000000</td>\n",
       "      <td>8.442400e+04</td>\n",
       "      <td>52.000000</td>\n",
       "      <td>32.000000</td>\n",
       "      <td>5.000000</td>\n",
       "      <td>40.000000</td>\n",
       "      <td>28.000000</td>\n",
       "      <td>25.000000</td>\n",
       "      <td>5.512400e+04</td>\n",
       "      <td>16.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>40.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>64.000000</td>\n",
       "      <td>5.533200e+05</td>\n",
       "      <td>64.000000</td>\n",
       "      <td>56.000000</td>\n",
       "      <td>8.000000</td>\n",
       "      <td>64.000000</td>\n",
       "      <td>29.000000</td>\n",
       "      <td>28.000000</td>\n",
       "      <td>4.319120e+05</td>\n",
       "      <td>16.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>144.000000</td>\n",
       "      <td>36.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>64.000000</td>\n",
       "      <td>1.466261e+07</td>\n",
       "      <td>64.000000</td>\n",
       "      <td>56.000000</td>\n",
       "      <td>10.000000</td>\n",
       "      <td>64.000000</td>\n",
       "      <td>95.000000</td>\n",
       "      <td>256.000000</td>\n",
       "      <td>5.000000e+304</td>\n",
       "      <td>4096.000000</td>\n",
       "      <td>...</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>38.000000</td>\n",
       "      <td>688.000000</td>\n",
       "      <td>18.000000</td>\n",
       "      <td>15800.000000</td>\n",
       "      <td>159404.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>8 rows × 119 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       ProgramHeaderOffset  SectionHeaderOffset   HeaderSize  \\\n",
       "count          9124.000000         9.124000e+03  9124.000000   \n",
       "mean             55.000877         3.620966e+05    55.023674   \n",
       "std               5.335484         7.717231e+05     5.210034   \n",
       "min               0.000000         2.440000e+02    52.000000   \n",
       "25%              52.000000         4.202100e+04    52.000000   \n",
       "50%              52.000000         8.442400e+04    52.000000   \n",
       "75%              64.000000         5.533200e+05    64.000000   \n",
       "max              64.000000         1.466261e+07    64.000000   \n",
       "\n",
       "       SizeProgramHeader  EntriesProgram  SizeSectionHeader  EntriesSection  \\\n",
       "count        9124.000000     9124.000000        9124.000000     9124.000000   \n",
       "mean           38.033319        5.439391          46.047348       24.057541   \n",
       "std            10.449703        2.486828          10.420069        8.234378   \n",
       "min             0.000000        0.000000          40.000000        3.000000   \n",
       "25%            32.000000        3.000000          40.000000       16.000000   \n",
       "50%            32.000000        5.000000          40.000000       28.000000   \n",
       "75%            56.000000        8.000000          64.000000       29.000000   \n",
       "max            56.000000       10.000000          64.000000       95.000000   \n",
       "\n",
       "       StringTableIndex     .text_size  .text_alignment      ...        \\\n",
       "count       9124.000000   9.105000e+03      9105.000000      ...         \n",
       "mean          21.676896  1.098298e+301        18.483251      ...         \n",
       "std            8.887494            inf        43.408611      ...         \n",
       "min            1.000000   0.000000e+00         1.000000      ...         \n",
       "25%           13.000000   1.582500e+04        16.000000      ...         \n",
       "50%           25.000000   5.512400e+04        16.000000      ...         \n",
       "75%           28.000000   4.319120e+05        16.000000      ...         \n",
       "max          256.000000  5.000000e+304      4096.000000      ...         \n",
       "\n",
       "         DYNPLTGOT      DYNHASH     DYNDEBUG  DYNFINI_ARRAY      DYNNULL  \\\n",
       "count  9124.000000  9124.000000  9124.000000    9124.000000  9124.000000   \n",
       "mean      0.272797     0.024989     0.272578       0.244191     0.273345   \n",
       "std       0.445422     0.156100     0.445310       0.429630     0.445701   \n",
       "min       0.000000     0.000000     0.000000       0.000000     0.000000   \n",
       "25%       0.000000     0.000000     0.000000       0.000000     0.000000   \n",
       "50%       0.000000     0.000000     0.000000       0.000000     0.000000   \n",
       "75%       1.000000     0.000000     1.000000       0.000000     1.000000   \n",
       "max       1.000000     1.000000     1.000000       1.000000     1.000000   \n",
       "\n",
       "       R_386_GLOB_DAT  R_386_JUMP_SLOT   R_386_COPY      GOT_SIZE  \\\n",
       "count     9124.000000      9124.000000  9124.000000   9124.000000   \n",
       "mean         0.039347         1.759097     0.030359    191.286716   \n",
       "std          0.695019        14.090788     0.387035    571.757800   \n",
       "min          0.000000         0.000000     0.000000      0.000000   \n",
       "25%          0.000000         0.000000     0.000000     12.000000   \n",
       "50%          0.000000         0.000000     0.000000     40.000000   \n",
       "75%          0.000000         0.000000     0.000000    144.000000   \n",
       "max         38.000000       688.000000    18.000000  15800.000000   \n",
       "\n",
       "           HASH_SIZE  \n",
       "count    9124.000000  \n",
       "mean      367.629110  \n",
       "std      6222.814762  \n",
       "min         0.000000  \n",
       "25%         0.000000  \n",
       "50%         0.000000  \n",
       "75%        36.000000  \n",
       "max    159404.000000  \n",
       "\n",
       "[8 rows x 119 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 9124 entries, 0 to 9123\n",
      "Data columns (total 148 columns):\n",
      "Name                          object\n",
      "Identification                object\n",
      "MachineType                   object\n",
      "ProgramHeaderOffset           int64\n",
      "SectionHeaderOffset           int64\n",
      "Flags                         object\n",
      "HeaderSize                    int64\n",
      "SizeProgramHeader             int64\n",
      "EntriesProgram                int64\n",
      "SizeSectionHeader             int64\n",
      "EntriesSection                int64\n",
      "StringTableIndex              int64\n",
      ".text_type                    object\n",
      ".text_size                    float64\n",
      ".text_alignment               float64\n",
      ".bss_type                     object\n",
      ".bss_size                     float64\n",
      ".bss_alignment                float64\n",
      ".comment_size                 float64\n",
      ".comment_entsize              float64\n",
      ".data_type                    object\n",
      ".data_size                    float64\n",
      ".data_alignment               float64\n",
      ".dynamic_type                 object\n",
      ".dynamic_size                 float64\n",
      ".dynamic_entsize              float64\n",
      ".dynamic_table_index_link     float64\n",
      ".dynamic_alignment            float64\n",
      ".dynstr_type                  object\n",
      ".dynstr_size                  float64\n",
      ".dynsym_type                  object\n",
      ".dynsym_size                  float64\n",
      ".dynsym_entsize               float64\n",
      ".dynsym_table_index_link      float64\n",
      ".dynsym_info                  float64\n",
      ".dynsym_alignment             float64\n",
      ".fini_type                    object\n",
      ".fini_size                    float64\n",
      ".fini_alignment               float64\n",
      ".hash_type                    object\n",
      ".hash_table_index_link        float64\n",
      ".hash_alignment               float64\n",
      ".gnu.hash_type                object\n",
      ".gnu.hash_size                float64\n",
      ".gnu.hash_entsize             float64\n",
      ".gnu.hash_table_index_link    float64\n",
      ".gnu.hash_alignment           float64\n",
      ".init_type                    object\n",
      ".init_size                    float64\n",
      ".init_alignment               float64\n",
      ".got_type                     object\n",
      ".got_flags                    object\n",
      ".got_size                     float64\n",
      ".got_entsize                  float64\n",
      ".got_alignment                float64\n",
      ".interp_type                  object\n",
      ".interp_size                  float64\n",
      ".plt_type                     object\n",
      ".plt_flags                    object\n",
      ".plt_size                     float64\n",
      ".plt_entsize                  object\n",
      ".plt_alignment                float64\n",
      ".rodata_type                  object\n",
      ".rodata_flags                 object\n",
      ".rodata_size                  float64\n",
      ".rodata_entsize               float64\n",
      ".rodata_alignment             float64\n",
      ".shstrtab_size                float64\n",
      ".strtab_size                  float64\n",
      ".symtab_size                  float64\n",
      ".symtab_entsize               float64\n",
      ".symtab_table_index_link      float64\n",
      ".symtab_info                  float64\n",
      ".symtab_alignment             float64\n",
      ".sbss_type                    object\n",
      ".sbss_flags                   object\n",
      ".rel.dyn_type                 object\n",
      ".rel.plt_type                 object\n",
      ".rel.plt_flags                object\n",
      ".got.plt_type                 object\n",
      ".got.plt_size                 float64\n",
      ".got.plt_entsize              float64\n",
      ".got.plt_alignment            float64\n",
      "STB_LOCAL                     int64\n",
      "dynamic_s_c                   int64\n",
      "STT_OBJECT_STB_GLOBAL         int64\n",
      "STT_OBJECT_STB_WEAK           int64\n",
      "STT_NOTYPE_STB_WEAK           int64\n",
      "STB_WEAK                      int64\n",
      "STT_NOTYPE_STB_LOCAL          int64\n",
      "STT_FUNC                      int64\n",
      "STT_FUNC_STB_GLOBAL           int64\n",
      "STT_NOTYPE_STB_GLOBAL         int64\n",
      "STB_GLOBAL                    int64\n",
      "STT_NOTYPE                    int64\n",
      "STT_OBJECT                    int64\n",
      "STT_FUNC_STB_WEAK             int64\n",
      "s_STT_FUNC_STB_LOCAL          int64\n",
      "symbol_tab                    int64\n",
      "s_STT_FUNC_STB_WEAK           int64\n",
      "s_STT_FUNC                    int64\n",
      "s_STB_LOCAL                   int64\n",
      "s_STT_FUNC_STB_GLOBAL         int64\n",
      "s_STB_GLOBAL                  int64\n",
      "s_STB_WEAK                    int64\n",
      "s_STT_OBJECT_STB_WEAK         int64\n",
      "s_STT_OBJECT                  int64\n",
      "s_STT_OBJECT_STB_LOCAL        int64\n",
      "s_STT_NOTYPE                  int64\n",
      "s_STT_NOTYPE_STB_GLOBAL       int64\n",
      "s_STT_NOTYPE_STB_WEAK         int64\n",
      "s_STT_NOTYPE_STB_LOCAL        int64\n",
      "s_STT_OBJECT_STB_GLOBAL       int64\n",
      "DYNRELAENT                    int64\n",
      "DYNFINI                       int64\n",
      "DYNPLTRELSZ                   int64\n",
      "DYNVERNEEDNUM                 int64\n",
      "DYNINIT_ARRAY                 int64\n",
      "DYNSTRSZ                      int64\n",
      "DYNSTRTAB                     int64\n",
      "DYNPLTREL                     int64\n",
      "DYNRELENT                     int64\n",
      "DYN                           int64\n",
      "DYNJMPREL                     int64\n",
      "DYNSYMTAB                     int64\n",
      "DYNRPATH                      int64\n",
      "DYNFINI_ARRAYSZ               int64\n",
      "DYNNEEDED                     int64\n",
      "DYNSYMENT                     int64\n",
      "DYNCOUNT                      int64\n",
      "DYNINIT                       int64\n",
      "DYNRELSZ                      int64\n",
      "DYNINIT_ARRAYSZ               int64\n",
      "DYNVERNEED                    int64\n",
      "DYNRELASZ                     int64\n",
      "DYNREL                        int64\n",
      "DYNRELA                       int64\n",
      "DYNPLTGOT                     int64\n",
      "DYNHASH                       int64\n",
      "DYNDEBUG                      int64\n",
      "DYNFINI_ARRAY                 int64\n",
      "DYNNULL                       int64\n",
      "R_386_GLOB_DAT                int64\n",
      "R_386_JUMP_SLOT               int64\n",
      "R_386_COPY                    int64\n",
      "GOT_SIZE                      int64\n",
      "HASH_SIZE                     int64\n",
      "label                         object\n",
      "dtypes: float64(47), int64(72), object(29)\n",
      "memory usage: 10.3+ MB\n"
     ]
    }
   ],
   "source": [
    "df.info(verbose=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Name</th>\n",
       "      <th>Identification</th>\n",
       "      <th>MachineType</th>\n",
       "      <th>ProgramHeaderOffset</th>\n",
       "      <th>SectionHeaderOffset</th>\n",
       "      <th>Flags</th>\n",
       "      <th>HeaderSize</th>\n",
       "      <th>SizeProgramHeader</th>\n",
       "      <th>EntriesProgram</th>\n",
       "      <th>SizeSectionHeader</th>\n",
       "      <th>...</th>\n",
       "      <th>DYNHASH</th>\n",
       "      <th>DYNDEBUG</th>\n",
       "      <th>DYNFINI_ARRAY</th>\n",
       "      <th>DYNNULL</th>\n",
       "      <th>R_386_GLOB_DAT</th>\n",
       "      <th>R_386_JUMP_SLOT</th>\n",
       "      <th>R_386_COPY</th>\n",
       "      <th>GOT_SIZE</th>\n",
       "      <th>HASH_SIZE</th>\n",
       "      <th>label</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>42d7e2ac43d89f40d5e0debf3a4294fce4ee75ffae2db9...</td>\n",
       "      <td>7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00</td>\n",
       "      <td>Intel 80386</td>\n",
       "      <td>52</td>\n",
       "      <td>2345688</td>\n",
       "      <td>0</td>\n",
       "      <td>52</td>\n",
       "      <td>32</td>\n",
       "      <td>8</td>\n",
       "      <td>40</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1316</td>\n",
       "      <td>156</td>\n",
       "      <td>M</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>pstopnm</td>\n",
       "      <td>7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00</td>\n",
       "      <td>Advanced Micro Devices X86-64</td>\n",
       "      <td>64</td>\n",
       "      <td>16976</td>\n",
       "      <td>0</td>\n",
       "      <td>64</td>\n",
       "      <td>56</td>\n",
       "      <td>9</td>\n",
       "      <td>64</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>336</td>\n",
       "      <td>56</td>\n",
       "      <td>B</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2a5c4b8a739b4c1c85f4866abb02a4699112d09d60ea41...</td>\n",
       "      <td>7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00</td>\n",
       "      <td>Intel 80386</td>\n",
       "      <td>52</td>\n",
       "      <td>95428</td>\n",
       "      <td>0</td>\n",
       "      <td>52</td>\n",
       "      <td>32</td>\n",
       "      <td>3</td>\n",
       "      <td>40</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>12</td>\n",
       "      <td>0</td>\n",
       "      <td>M</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>7fbce893dc6a51456fadcf86179ac0eff9026eb17b7f04...</td>\n",
       "      <td>7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00</td>\n",
       "      <td>Advanced Micro Devices X86-64</td>\n",
       "      <td>64</td>\n",
       "      <td>721864</td>\n",
       "      <td>0</td>\n",
       "      <td>64</td>\n",
       "      <td>56</td>\n",
       "      <td>5</td>\n",
       "      <td>64</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>32</td>\n",
       "      <td>0</td>\n",
       "      <td>M</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>971062ea5bcbfd9998ff22acebc1a361a151fb1fb8d4e6...</td>\n",
       "      <td>7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00</td>\n",
       "      <td>Intel 80386</td>\n",
       "      <td>52</td>\n",
       "      <td>90292</td>\n",
       "      <td>0</td>\n",
       "      <td>52</td>\n",
       "      <td>32</td>\n",
       "      <td>3</td>\n",
       "      <td>40</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>12</td>\n",
       "      <td>0</td>\n",
       "      <td>M</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 148 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                Name  \\\n",
       "0  42d7e2ac43d89f40d5e0debf3a4294fce4ee75ffae2db9...   \n",
       "1                                            pstopnm   \n",
       "2  2a5c4b8a739b4c1c85f4866abb02a4699112d09d60ea41...   \n",
       "3  7fbce893dc6a51456fadcf86179ac0eff9026eb17b7f04...   \n",
       "4  971062ea5bcbfd9998ff22acebc1a361a151fb1fb8d4e6...   \n",
       "\n",
       "                                    Identification  \\\n",
       "0  7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00   \n",
       "1  7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00   \n",
       "2  7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00   \n",
       "3  7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00   \n",
       "4  7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00   \n",
       "\n",
       "                     MachineType  ProgramHeaderOffset  SectionHeaderOffset  \\\n",
       "0                    Intel 80386                   52              2345688   \n",
       "1  Advanced Micro Devices X86-64                   64                16976   \n",
       "2                    Intel 80386                   52                95428   \n",
       "3  Advanced Micro Devices X86-64                   64               721864   \n",
       "4                    Intel 80386                   52                90292   \n",
       "\n",
       "  Flags  HeaderSize  SizeProgramHeader  EntriesProgram  SizeSectionHeader  \\\n",
       "0     0          52                 32               8                 40   \n",
       "1     0          64                 56               9                 64   \n",
       "2     0          52                 32               3                 40   \n",
       "3     0          64                 56               5                 64   \n",
       "4     0          52                 32               3                 40   \n",
       "\n",
       "   ...    DYNHASH  DYNDEBUG DYNFINI_ARRAY  DYNNULL  R_386_GLOB_DAT  \\\n",
       "0  ...          0         0             0        0               0   \n",
       "1  ...          0         1             1        1               0   \n",
       "2  ...          0         0             0        0               0   \n",
       "3  ...          0         0             0        0               0   \n",
       "4  ...          0         0             0        0               0   \n",
       "\n",
       "  R_386_JUMP_SLOT  R_386_COPY  GOT_SIZE  HASH_SIZE  label  \n",
       "0               0           0      1316        156      M  \n",
       "1               0           0       336         56      B  \n",
       "2               0           0        12          0      M  \n",
       "3               0           0        32          0      M  \n",
       "4               0           0        12          0      M  \n",
       "\n",
       "[5 rows x 148 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "ename": "KeyError",
     "evalue": "'ELFVersion'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mKeyError\u001b[0m                                  Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-6-d61cd4431370>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[0mdf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdrop\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'Name'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minplace\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mTrue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mdf\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'ELFVersion'\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdf\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'ELFVersion'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mapply\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;32mlambda\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      3\u001b[0m \u001b[0mdf\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'Flags'\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdf\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'Flags'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mapply\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;32mlambda\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/usr/local/lib/python2.7/dist-packages/pandas/core/frame.pyc\u001b[0m in \u001b[0;36m__getitem__\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m   1962\u001b[0m             \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_getitem_multilevel\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1963\u001b[0m         \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1964\u001b[0;31m             \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_getitem_column\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   1965\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1966\u001b[0m     \u001b[0;32mdef\u001b[0m \u001b[0m_getitem_column\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/usr/local/lib/python2.7/dist-packages/pandas/core/frame.pyc\u001b[0m in \u001b[0;36m_getitem_column\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m   1969\u001b[0m         \u001b[0;31m# get column\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1970\u001b[0m         \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcolumns\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mis_unique\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1971\u001b[0;31m             \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_item_cache\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   1972\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1973\u001b[0m         \u001b[0;31m# duplicate columns & possible reduce dimensionality\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/usr/local/lib/python2.7/dist-packages/pandas/core/generic.pyc\u001b[0m in \u001b[0;36m_get_item_cache\u001b[0;34m(self, item)\u001b[0m\n\u001b[1;32m   1643\u001b[0m         \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcache\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mitem\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1644\u001b[0m         \u001b[0;32mif\u001b[0m \u001b[0mres\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1645\u001b[0;31m             \u001b[0mvalues\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_data\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mitem\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   1646\u001b[0m             \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_box_item_values\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mitem\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalues\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   1647\u001b[0m             \u001b[0mcache\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mitem\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mres\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/usr/local/lib/python2.7/dist-packages/pandas/core/internals.pyc\u001b[0m in \u001b[0;36mget\u001b[0;34m(self, item, fastpath)\u001b[0m\n\u001b[1;32m   3588\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   3589\u001b[0m             \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0misnull\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mitem\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3590\u001b[0;31m                 \u001b[0mloc\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mitems\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_loc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mitem\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   3591\u001b[0m             \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   3592\u001b[0m                 \u001b[0mindexer\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0marange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mitems\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0misnull\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mitems\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/usr/local/lib/python2.7/dist-packages/pandas/core/indexes/base.pyc\u001b[0m in \u001b[0;36mget_loc\u001b[0;34m(self, key, method, tolerance)\u001b[0m\n\u001b[1;32m   2442\u001b[0m                 \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_engine\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_loc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2443\u001b[0m             \u001b[0;32mexcept\u001b[0m \u001b[0mKeyError\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2444\u001b[0;31m                 \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_engine\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_loc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_maybe_cast_indexer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   2445\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   2446\u001b[0m         \u001b[0mindexer\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_indexer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmethod\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mmethod\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtolerance\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mtolerance\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32mpandas/_libs/index.pyx\u001b[0m in \u001b[0;36mpandas._libs.index.IndexEngine.get_loc (pandas/_libs/index.c:5280)\u001b[0;34m()\u001b[0m\n",
      "\u001b[0;32mpandas/_libs/index.pyx\u001b[0m in \u001b[0;36mpandas._libs.index.IndexEngine.get_loc (pandas/_libs/index.c:5126)\u001b[0;34m()\u001b[0m\n",
      "\u001b[0;32mpandas/_libs/hashtable_class_helper.pxi\u001b[0m in \u001b[0;36mpandas._libs.hashtable.PyObjectHashTable.get_item (pandas/_libs/hashtable.c:20523)\u001b[0;34m()\u001b[0m\n",
      "\u001b[0;32mpandas/_libs/hashtable_class_helper.pxi\u001b[0m in \u001b[0;36mpandas._libs.hashtable.PyObjectHashTable.get_item (pandas/_libs/hashtable.c:20477)\u001b[0;34m()\u001b[0m\n",
      "\u001b[0;31mKeyError\u001b[0m: 'ELFVersion'"
     ]
    }
   ],
   "source": [
    "df.drop(['Name'], axis=1, inplace=True)\n",
    "df['ELFVersion'] = df['ELFVersion'].apply(lambda x: x[2:])\n",
    "df['Flags'] = df['Flags'].apply(lambda x: x[2:])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# df['EntryPointAddress'] = df['EntryPointAddress'].apply(lambda x: x[2:])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "req_col = [a for a in df.columns if '_size' in a]\n",
    "req_col\n",
    "req_col.extend([a for a in df.columns if 'entsize' in a])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "for i in req_col:\n",
    "    df[i] = df[i].apply(lambda x: str(x).replace(\".0\", ''))\n",
    "for i in req_col:\n",
    "    df[i] = df[i].apply(lambda x: int(str(x), 16) if x != \"nan\" and \"E\" not in str(x).upper() else x)\n",
    "    df[i] = df[i].apply(lambda x: np.NaN if x != \"nan\" and \"E\" in str(x).upper() else x)\n",
    "    df[i] = df[i].apply(lambda x: np.NaN if x == \"nan\" else x)\n",
    "    df[i] = pd.to_numeric(df[i])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "df['.text_size']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "df.to_csv(\"./dataset/final_final.csv\", index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
